package it.test.java.decoratord.pay.decorator;

import it.test.java.decoratord.pay.domain.Order;
import lombok.AllArgsConstructor;

import java.math.BigDecimal;

/**
 * @Copyright 纳新智能科技有限公司
 * @Author Liky
 * @Date 2023/9/27
 */
@AllArgsConstructor
public class CountDecorator implements IBaseCount{
    private IBaseCount baseCount;
    @Override
    public BigDecimal getMoney(Order order) {
        BigDecimal money = BigDecimal.ZERO;
        if(null != order.getOrderDetailList() && order.getOrderDetailList().size()>0){
            money = baseCount.getMoney(order);
        }
        return money;
    }
}
